<?php
namespace app\banquet\controller;
use app\AdminRest;


use app\ApiRest;
use app\banquet\model\AtvContent;
use app\banquet\model\Config;
use app\banquet\model\Evaluate;
use app\banquet\model\Order;
use app\banquet\model\OrderContent;
use app\banquet\model\Package;
use app\banquet\model\Place;
use app\banquet\model\PlaceDate;
use app\banquet\model\PlaceIv;
use app\banquet\model\Refund;
use app\card\model\Company;
use app\card\model\User;
use app\card\model\UserInfo;
use app\member\model\Member;
use app\publics\model\TmplConfig;
use think\App;
use think\facade\Db;


class IndexPlace extends ApiRest
{

    protected $model;

    protected $date_model;

    protected $package_model;

    protected $order_model;



    public function __construct(App $app) {

        parent::__construct($app);

        $this->model  = new Place();

        $this->date_model  = new PlaceDate();

        $this->package_model  = new Package();

        $this->order_model  = new Order();

        $this->order_model->autoCancelOrder($this->_uniacid);


    }


    /**
     * @author chenniang
     * @DataTime: 2021-12-23 16:19
     * @功能说明:列表
     */
    public function index(){

        $input = $this->_param;

        $staff_model = new UserInfo();

        $data['company'] = lbUserCompanyInfo($input['staff_id']);

        $data['company']['service_tag'] = !empty($data['company']['service_tag'])?explode(',',$data['company']['service_tag']):[];

        $data['staff_info']['staff_name']   = lbUserName($input['staff_id']);

        $data['staff_info']['staff_avatar'] = lbUserAvatar($input['staff_id']);

        $data['staff_info']['mobile'] = $staff_model->where(['fans_id'=>$input['staff_id']])->value('phone');

        $dis = [

            'company_id' => $data['company']['id'],

            'status'     => 1
        ];
        //场地
        $data['place'] = $this->model->where($dis)->order('top desc,id desc')->limit(50)->select()->toArray();

        $place_id = $this->model->where($dis)->column('id');
        //宴席
        $data['package'] = $this->package_model->indexSelect($place_id);

        if(!empty($data['place'])){

            $iv_model = new PlaceIv();

            foreach ($data['place'] as &$v){

                $dis = [

                  'place_id' => $v['id']
                ];
                //浏览数量
                $v['iv_data']['iv_count'] = $iv_model->where($dis)->count();
                //浏览列表 只查5条
                $v['iv_data']['iv_list']  = $iv_model->userIvListLimit($v['id'],5);

            }
        }

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2021-12-27 13:58
     * @功能说明:获取公司列表
     */
    public function companyList(){

        $input = $this->_param;

        $lat = !empty($input['latitude'])?$input['latitude']:0;

        $lng = !empty($input['long'])?$input['long']:0;

        $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*('.$lng.'- `longitude`)/360),2)+COS(PI()*33.07078170776367/180)* COS('.$lat.' * PI()/180)*POW(SIN(PI()*('.$lat.'- latitude)/360),2))))*1000 as distance';

        $company_model = new Company();

        $dis[] = ['a.uniacid','=',$this->_uniacid];

        $dis[] = ['a.status','=',1];

        $dis[] = ['a.pid','=',0];

        $dis[] = ['b.is_staff','=',1];

        if(!empty($input['name'])){

            $dis[] = ['a.name','like','%'.$input['name'].'%'];

        }

        if(!empty($input['short_name'])){

            $dis[] = ['a.short_name','like','%'.$input['short_name'].'%'];

        }

        $data = $company_model->alias('a')
                ->join('longbing_card_user_info b','a.staff_id = b.fans_id AND a.id = b.company_id')
                ->where($dis)
                ->field(['a.*',$alh])
                ->order('distance,id desc')
                ->paginate(10)
                ->toArray();

//        $data = $company_model->where($dis)->field(['*',$alh])->order('distance desc,id desc')->paginate(10)->toArray();

        if(!empty($data['data'])){

            foreach ($data['data'] as &$v){

                $v['service_tag'] = !empty($v['service_tag'])?explode(',',$v['service_tag']):[];

                $v['distance'] = distance_text($v['distance']);

            }

        }

        return $this->success($data);

    }





    /**
     * @author chenniang
     * @DataTime: 2021-12-22 17:47
     * @功能说明:套餐列表
     */
    public function packageList(){

        $input = $this->_param;

        if(!empty($input['place_id'])){

            $place_id = $input['place_id'];

        }else{

            $data['company'] = lbUserCompanyInfo($input['staff_id']);

            $dis = [

                'company_id' => $data['company']['id'],

                'status'     => 1
            ];

            $place_id = $this->model->where($dis)->column('id');
        }
        //宴席
        $data = $this->package_model->indexSelect($place_id,1000);

        return $this->success($data);


    }





    /**
     * @author chenniang
     * @DataTime: 2021-11-18 17:51
     * @功能说明:套餐详情
     */
    public function packageInfo(){

        $input = $this->_param;

        $dis = [

            'id' => $input['id']
        ];

        $data = $this->package_model->dataInfo($dis);

        return $this->success($data);

    }





    /**
     * @author chenniang
     * @DataTime: 2021-11-18 17:58
     * @功能说明:场地列表
     */
    public function placeList(){

        $input = $this->_param;

        if(isset($input['status'])){

            $dis[] = ['status','=',$input['status']];

        }else{

            $dis[] = ['status','>',-1];
        }

        $dis[] = ['uniacid','=',$this->_uniacid];

        if(!empty($input['title'])){

            $dis[] = ['title','like','%'.$input['title'].'%'];
        }

        $data = $this->model->dataList($dis,$input['limit']);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2021-11-18 17:51
     * @功能说明:场地详情
     */
    public function placeInfo(){

        $input = $this->_param;

        $dis = [

            'id' => $input['id']
        ];

        $data = $this->model->dataInfo($dis);
        //增加浏览记录
        $iv_model = new PlaceIv();

        $dis = [

            'user_id' => $this->getUserId(),

            'place_id'=> $input['id'],

            'uniacid' => $this->_uniacid
        ];

        $find = $iv_model->dataInfo($dis);

        if(!empty($find)){

            $iv_model->dataUpdate($dis,['create_time'=>time()]);

        }else{

            $iv_model->dataAdd($dis);

            $this->model->dataUpdate(['id'=>$input['id']],['iv'=>$data['iv']+1]);

        }
        $dis = [

            'place_id' => $input['id'],

            'status'   => 1
        ];
        //浏览数量
        $data['iv_data']['iv_count'] = $iv_model->where($dis)->count();
        //浏览列表 只查5条
        $data['iv_data']['iv_list']  = $iv_model->userIvListLimit($input['id'],5);

        $ev_model = new Evaluate();
        //获取评价数量
        $data['eva']['eva_count'] = $ev_model->where($dis)->count();
        //评价列表 只查3条
        $data['eva']['eva_list']  = $ev_model->userEvaListLimit($input['id'],3);

        $content_model = new AtvContent();

        $data['content'] = $content_model->placeContent($data['id']);

        $data['video_vid'] = lbGetTencentVideo($data['video']);

        $data['text'] = getimgsV2($data['text']);

        return $this->success($data);

    }




    /**
     * @author chenniang
     * @DataTime: 2021-11-24 10:06
     * @功能说明:宴会厅场地评价列表
     */
    public function placeEvaluateList(){

        $input = $this->_param;

        $dis[] = ['a.uniacid','=',$this->_uniacid];

        $dis[] = ['a.status','=',1];

        $dis[] = ['a.place_id','=',$input['place_id']];


        if(!empty($input['good'])){

            $dis[] = ['a.eva_type','=',1];
        }

        if(!empty($input['bad'])){

            $dis[] = ['a.eva_type','<>',1];

        }

        $ev_model = new Evaluate();

        $data = $ev_model->userEvaList($dis);

        $where[] = ['uniacid','=',$this->_uniacid];

        $where[] = ['status','=',1];

        $where[] = ['place_id','=',$input['place_id']];

        $data['count']['goods'] = $ev_model->where($where)->where('eva_type','=',1)->count();

        $data['count']['bad']   = $ev_model->where($where)->where('eva_type','<>',1)->count();

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-14 14:20
     * @功能说明:评价详情
     */
    public function evaluateInfo(){

        $input = $this->_param;

        if(!empty($input['order_id'])){

            $dis['order_id'] = $input['order_id'];
        }

        if(!empty($input['id'])){

            $dis['id'] = $input['id'];
        }

        if(empty($dis)){

            $this->errorMsg('参数错误');
        }

        $ev_model = new Evaluate();

        $data = $ev_model->dataInfo($dis);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-14 14:20
     * @功能说明:修改删除评价
     */
    public function evaluateUpdate(){

        $input = $this->_input;

        $dis['id'] = $input['id'];

        $ev_model = new Evaluate();

        $eva_data = $ev_model->dataInfo($dis);

        $data = $ev_model->dataUpdate($dis,$input);
        //删除
        if(!empty($input['status'])&&$input['status']==-1){

            $order_model = new Order();

            $order_model->dataUpdate(['id'=>$eva_data['order_id']],['have_eva'=>0]);

            $ev_model->updatePlaceStar($eva_data['place_id']);

        }

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2021-12-02 15:24
     * @功能说明:添加评论
     */
    public function evaluateAdd(){

        $input = $this->_input;

        $ev_model = new Evaluate();

        $order_model = new Order();

        $order = $order_model->dataInfo(['id'=>$input['order_id']]);

        $input['uniacid'] = $this->_uniacid;

        $input['user_id'] = $this->getUserId();

        $input['place_id']= $order['place_id'];
        //平均分的
        $input['average_star'] = round(($input['hotel_star']+$input['sale_star']+$input['place_star'])/3,1);

        $input['imgs'] = !empty($input['imgs'])?implode(',',$input['imgs']):'';

        $res = $ev_model->dataAdd($input);
        //修改场地评分
        $res = $ev_model->updatePlaceStar($input['place_id']);
        //修改订单状态
        $order_model->dataUpdate(['id'=>$input['order_id']],['have_eva'=>1]);

        return $this->success($res);

    }



    /**
     * @author chenniang
     * @DataTime: 2021-12-23 14:38
     * @功能说明:获取档期
     */
    public function monthDateList(){

        $input = $this->_param;

        $beginDate = date('Y-m-01', strtotime(date($input['date'])));

        $endDate   = date('Y-m-d', strtotime("$beginDate +1 month -1 day"));

        $beginDate = strtotime($beginDate);

        $endDate   = strtotime($endDate);

        $dis = [

            'place_id'   => $input['place_id'],

            'month_date' => $input['date']
        ];

        $date_list = $this->date_model->where($dis)->select()->toArray();

        $i = 0;

        $order_model = new Order();

        $where[] = ['pay_type','>',0];

        $where[] = ['place_id','=',$input['place_id']];

        $where[] = ['time_date','between',"$beginDate,$endDate"];
        //查询当前月份 当前场地所有的订单信息
        $order = $order_model->where($where)->field('id,time_date,time_type')->select()->toArray();

        while ($beginDate<=$endDate){

            $data[$i]['time'] = $beginDate;

            $data[$i]['date'] = date('Y-m-d',$beginDate);

            if(!empty($date_list)){

                foreach ($date_list as $value){

                    if($value['time']==$beginDate){

                        $data[$i]['noon_price']  = $value['noon_price'];

                        $data[$i]['night_price'] = $value['night_price'];

                        $data[$i]['title']       = $value['title'];

                        $data[$i]['status']      = $value['status'];

                        $data[$i]['noon_status'] = $value['status'];

                        $data[$i]['night_status']= $value['night_price']>0?$value['status']:0;
                        //查看是否被预约
                        if(!empty($order)){

                            foreach ($order as $vs){

                                if($vs['time_date']==$beginDate&&$vs['time_type']==1){

                                    $data[$i]['noon_status'] = 0;

                                }

                                if($vs['time_date']==$beginDate&&$vs['time_type']==2){

                                    $data[$i]['night_status'] = 0;

                                }

                            }

                        }

                    }

                }

            }

            $beginDate +=86400;

            $i++;

        }

        $arr['date'] = $input['date'];

        $arr['list'] = $data;

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-17 16:33
     * @功能说明:订阅消息列表
     */
    public function tmpList(){
        //模版消息model
        $tmpl_model = new TmplConfig();
        //获取模版
        $tmpl       = $tmpl_model->where(['uniacid'=>$this->_uniacid,'tmpl_name'=>'banquet_order'])->select()->toArray();

        return $this->success($tmpl);

    }


    /**
     * @author chenniang
     * @DataTime: 2021-12-27 14:11
     * @功能说明:下单
     */
    public function payOrder(){

        $input = $this->_input;

        $place = $this->model->dataInfo(['id'=>$input['place_id'],'status'=>1]);

        if(empty($place)){

            $this->errorMsg('该场地已下架');
        }
        //查询该场地是否被预约
        $where = [

            'place_id' => $place['id'],

            'time_date'=> $input['time_date'],

            'time_type'=> $input['time_type']
        ];

        $find = $this->order_model->where($where)->where('pay_type','>',0)->find();

        if(!empty($find)){

            $this->errorMsg('该场地该时间段已被预约');
        }

        $config_model = new Config();

        $config = $config_model->dataInfo(['uniacid'=>$this->_uniacid]);

        $config['over_time'] = !empty($config['over_time'])?$config['over_time']:10;

        $config['can_refund_time'] = !empty($config['can_refund_time'])?$config['can_refund_time']:7;

        $order_insert = [

            'uniacid'    => $this->_uniacid,

            'order_code' => orderCode(),

            'user_id'    => $this->getUserId(),

            'pay_price'  => $place['price'],

            'balance'    => !empty($input['is_balance'])?$place['price']:0,

            'place_id'   => $place['id'],

            'place_title'=> $place['title'],

            'place_cover'=> $place['cover'],

            'min_num'    => $place['min_num'],

            'max_num'    => $place['max_num'],

            'place_price'=> $place['price'],

            'time_date'  => $input['time_date'],

            'time_type'  => $input['time_type'],

            'staff_id'   => $input['staff_id'],

            'over_time'  => time()+$config['over_time']*60,

            'can_refund_time' => time()+$config['can_refund_time']*86400,

            'company_id' => $place['company_id']
        ];


        $order_model = new Order();

        $res = $order_model->dataAdd($order_insert);

        if($res==0){

            $this->errorMsg('下单失败');
        }

        $order_id = $order_model->getLastInsID();
        //添加报名信息
        if(!empty($input['content'])){

            foreach ($input['content'] as $key => $value){

                $input['content'][$key]['uniacid']  = $this->_uniacid;

                $input['content'][$key]['order_id'] = $order_id;

            }

            $order_content = new OrderContent();

            $order_content->saveAll($input['content']);
        }

        //余额支付
        if(!empty($input['is_balance'])){

            $member_model = new Member();

            $member = $member_model->getMemberInfo(['user_id'=>$this->getUserId()]);

            if($order_insert['balance']>$member['stored']){

                $this->errorMsg('余额不足');

            }
            //回调
            $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']);

            $arr['pay_list']   = '';

            return $this->success($arr);

        }
        //如果是0元
        if($order_insert['pay_price']<=0){

            $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']);

            return $this->success(true);
        }
        //微信支付
        $pay_controller = new \app\shop\controller\IndexWxPay($this->app);
        //支付
        $jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"场地预定",['type' => 'banquetPlace' , 'out_trade_no' => $order_insert['order_code']],$order_insert['pay_price']);

        $arr['pay_list']= $jsApiParameters;

        return $this->success($arr);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-07 14:22
     * @功能说明:重新支付
     */
    public function rePayOrder(){

        $input = $this->_param;

        $order_model = new Order();

        $dis = [

            'id' => $input['id']
        ];

        $order_insert = $order_model->dataInfo($dis);

        if($order_insert['pay_type']!=1){

            $this->errorMsg('订单状态错误');
        }

        //余额支付
        if($order_insert['balance']>0){

            $member_model = new Member();

            $member = $member_model->getMemberInfo(['user_id'=>$this->getUserId()]);

            if($order_insert['balance']>$member['stored']){

                $this->errorMsg('余额不足');

            }
            //回调
            $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']);

            $arr['pay_list']   = '';

            return $this->success($arr);

        }
        //微信支付
        $pay_controller = new \app\shop\controller\IndexWxPay($this->app);
        //支付
        $jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"场地预定",['type' => 'banquetPlace' , 'out_trade_no' => $order_insert['order_code']],$order_insert['pay_price']);

        $arr['pay_list']= $jsApiParameters;

        return $this->success($arr);
    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-07 15:28
     * @功能说明:订单列表
     */
    public function orderList(){

        $input = $this->_param;

        $order_model = new Order();

        $dis = [

            'user_id' => $this->getUserId(),

            'uniacid' => $this->_uniacid,

        ];

        if(!empty($input['have_eva'])){

            $dis['have_eva'] = $input['have_eva'];

            $input['pay_type'] = 0;
        }

        if(!empty($input['pay_type'])){

            $dis['pay_type'] = $input['pay_type'];

            $dis['have_eva'] = 0;
        }

        $data = $order_model->dataList($dis);

        if(!empty($data['data'])){

            foreach ($data['data'] as &$v){

                $v['week']      = changeWeek(date('w',$v['time_date']));

                $v['time_date'] = date('Y-m-d',$v['time_date']);

                $v['time_type'] = $v['time_type']==1?'中午':'晚上';

                if($v['pay_type']==2&&$v['can_refund_time']>time()){

                    $v['can_refund'] = 1;

                }else{

                    $v['can_refund'] = 0;

                }

                if($v['pay_type']==2&&$v['have_eva']==0&&$v['can_refund_time']<time()){

                    $v['can_eva'] = 1;

                }else{

                    $v['can_eva'] = 0;

                }

            }

        }

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-07 15:34
     * @功能说明:订单详情
     */
    public function orderInfo(){

        $input = $this->_param;

        $order_model = new Order();

        $dis = [

            'id' => $input['id'],
        ];

        $data = $order_model->dataInfo($dis);

        $data['week']      = changeWeek(date('w',$data['time_date']));

        $data['time_date'] = date('Y-m-d',$data['time_date']);

        $data['time_type'] = $data['time_type']==1?'中午':'晚上';

        $data['over_time']  -= time();

        $data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);

        $data['pay_time']    = !empty($data['pay_time'])?date('Y-m-d H:i:s',$data['pay_time']):0;

        if($data['pay_type']==2&&$data['can_refund_time']>time()){

            $data['can_refund'] = 1;

        }else{

            $data['can_refund'] = 0;

        }

        if($data['pay_type']==2&&$data['have_eva']==0&&$data['can_refund_time']<time()){

            $data['can_eva'] = 1;

        }else{

            $data['can_eva'] = 0;

        }

        return $this->success($data);
    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-07 16:44
     * @功能说明:申请退款
     */
    public function applyOrder(){

        $input = $this->_input;

        $order_model = new Order();

        $order = $order_model->dataInfo(['id'=>$input['order_id']]);

        if($order['pay_type']<2){

            $this->errorMsg('订单状态错误');
        }

        if($order['refund']!=0){

            $this->errorMsg('你已申请过退款');
        }

        $insert = [

            'uniacid'     => $this->_uniacid,

            'user_id'     => $this->getUserId(),

            'order_id'    => $input['order_id'],

            'order_code'  => orderCode(),

            'staff_id'    => $order['staff_id'],

            'apply_price' => $order['pay_price'],

            'place_id'    => $order['place_id'],

            'place_title' => $order['place_title'],

            'place_cover' => $order['place_cover'],

            'place_price' => $order['place_price'],

            'time_date'   => $order['time_date'],

            'time_type'   => $order['time_type'],

            'company_id'  => $order['company_id'],

            'balance'     => $order['balance'],

            'min_num'     => $order['min_num'],

            'max_num'     => $order['max_num'],

            'text' => $input['text'],

            'imgs' => !empty($input['imgs'])?implode(',',$input['imgs']):'',

        ];

        $refund_model = new Refund();

        Db::startTrans();

        $res = $refund_model->dataAdd($insert);

        if($res==0){

            Db::rollback();

            $this->errorMsg('申请失败');

        }

        $res = $order_model->dataUpdate(['id'=>$input['order_id']],['refund'=>1]);

        if($res==0){

            Db::rollback();

            $this->errorMsg('申请失败');

        }

        Db::commit();

        return $this->success($res);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-14 13:40
     * @功能说明:取消订单
     */
    public function cancelOrder(){

        $input = $this->_input;

        $order_model = new Order();

        $data = $order_model->dataInfo(['id'=>$input['id']]);

        if($data['pay_type']!=1){

            $this->errorMsg('订单状态错误，无法取消');
        }

        $update = [

            'cancel_time' => time(),

            'pay_type'    => -1
        ];

        $res = $order_model->dataUpdate(['id'=>$input['id']],$update);

        return $this->success($res);


    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-12 17:52
     * @功能说明:取消退款
     */
    public function cancelRefund(){

        $input = $this->_input;

        $refund_model = new Refund();

        $order_model = new Order();

        $refund = $refund_model->dataInfo(['id'=>$input['id']]);

        if($refund['status']!=1){

            $this->errorMsg('状态错误请重试');
        }

        $res = $refund_model->dataUpdate(['id'=>$input['id']],['status'=>-1]);

        $res = $order_model->dataUpdate(['id'=>$refund['order_id']],['refund'=>0]);

        return $this->success($res);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-07 17:03
     * @功能说明:退款列表
     */
    public function refundList(){

        $input = $this->_param;

        $dis[] = ['user_id','=',$this->getUserId()];

        if(!empty($input['status'])){

            $dis[] = ['status','=',$input['status']];

        }else{

            $dis[] = ['status','>',-1];

        }

        $refund_model = new Refund();

        $data = $refund_model->dataList($dis);

        if(!empty($data['data'])){

            foreach ($data['data'] as &$v){

                $v['week']      = changeWeek(date('w',$v['time_date']));

                $v['time_date'] = date('Y-m-d',$v['time_date']);

                $v['time_type'] = $v['time_type']==1?'中午':'晚上';


            }

        }

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2022-01-07 17:03
     * @功能说明:退款列表
     */
    public function refundInfo(){

        $input = $this->_param;

        $dis = [

            'id' => $input['id']
        ];

        $refund_model = new Refund();

        $data = $refund_model->dataInfo($dis);

        $data['week']        = changeWeek(date('w',$data['time_date']));

        $data['time_date']   = date('Y-m-d',$data['time_date']);

        $data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);

        $data['refund_time'] = date('Y-m-d H:i:s',$data['refund_time']);

        $data['time_type']   = $data['time_type']==1?'中午':'晚上';

        $order_model = new Order();

        $pay_order = $order_model->dataInfo(['id'=>$data['order_id']]);

        $data['pay_order_code'] = $pay_order['order_code'];

        $data['content'] = $pay_order['content'];

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2021-12-23 16:56
     * @功能说明:配置详情
     */

    public function configInfo(){

        $config_model = new Config();

        $dis = [

            'uniacid' => $this->_uniacid
        ];

        $data = $config_model->dataInfo($dis);

        return $this->success($data);

    }









}
